VintaSoft Imaging .NET SDK 14.0: Documentation for .NET developer
Vintasoft.Imaging.Codecs.ImageFiles.Raw Namespace / DngPage Class / GetThumbnailImage Methods / GetThumbnailImage(EventHandler<ProgressEventArgs>) Method
Syntax Example Requirements SeeAlso
In This Topic
    GetThumbnailImage(EventHandler<ProgressEventArgs>) Method (DngPage)
    In This Topic
    Returns a thumbnail image associated with this image page.
    Syntax

    Parameters

    progressDelegate
    Progress delegate.

    Return Value

    The thumbnail image associated with this ImagePage object if thumbnail image was loaded successfully; otherwise, null.
    Example

    Here is an example that shows how to open DNG-file, get thumbnail image from DNG-file and save image to a PNG-file:

    
    ''' <summary>
    ''' Opens DNG-file, gets thumbnail image from DNG-file and saves image to a PNG-file.
    ''' </summary>
    ''' <param name="dngFilename">The name of DNG-file.</param>
    Public Sub GetAndSaveCrwThumbnail(dngFilename As String)
        ' open DNG-file stream
        Using fs As New System.IO.FileStream(dngFilename, System.IO.FileMode.Open, System.IO.FileAccess.Read)
            ' open DNG-file
            Dim rawImageFile As New Vintasoft.Imaging.Codecs.ImageFiles.Raw.RawImageFile(fs)
            ' get DNG-page
            Dim dngPage As Vintasoft.Imaging.Codecs.ImageFiles.Raw.DngPage = TryCast(rawImageFile.Page, Vintasoft.Imaging.Codecs.ImageFiles.Raw.DngPage)
            ' if DNG-page is found in RAW-file
            If dngPage IsNot Nothing Then
                ' get thumbnail image from DNG-file
                Using cr2Thumbnail As Vintasoft.Imaging.VintasoftImage = dngPage.GetThumbnailImage()
                    ' save image to a PNG file
                    cr2Thumbnail.Save(dngFilename & ".png")
                End Using
            End If
        End Using
    End Sub
    
    
    
    /// <summary>
    /// Opens DNG-file, gets thumbnail image from DNG-file and saves image to a PNG-file.
    /// </summary>
    /// <param name="dngFilename">The name of DNG-file.</param>
    public void GetAndSaveCrwThumbnail(string dngFilename)
    {
        // open DNG-file stream
        using (System.IO.FileStream fs = new System.IO.FileStream(dngFilename, System.IO.FileMode.Open, System.IO.FileAccess.Read))
        {
            // open DNG-file
            Vintasoft.Imaging.Codecs.ImageFiles.Raw.RawImageFile rawImageFile =
                new Vintasoft.Imaging.Codecs.ImageFiles.Raw.RawImageFile(fs);
            // get DNG-page
            Vintasoft.Imaging.Codecs.ImageFiles.Raw.DngPage dngPage =
                rawImageFile.Page as Vintasoft.Imaging.Codecs.ImageFiles.Raw.DngPage;
            // if DNG-page is found in RAW-file
            if (dngPage != null)
            {
                // get thumbnail image from DNG-file
                using (Vintasoft.Imaging.VintasoftImage cr2Thumbnail = dngPage.GetThumbnailImage())
                {
                    // save image to a PNG file
                    cr2Thumbnail.Save(dngFilename + ".png");
                }
            }
        }
    }
    
    

    Requirements

    Target Platforms: .NET9; .NET 8; .NET 7; .NET 6; .NET Framework 4.8, 4.7, 4.6, 4.5, 4.0, 3.5

    See Also